package com.itheima.mapper;
import com.github.pagehelper.Page;
import com.itheima.pojo.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;

/**
 * 员工管理
 */
@Mapper
public interface EmpMapper {




    //员工批量删除
    //参数是id的集合,无返回值
    //接口文档是要数组形式的ids
    //void deleteByIds(List<Integer> ids);




    //@Select("select * from tlias.emp")
    //Page<Emp> list(Integer start, Integer pageSize);
    //按条件分页查询
   Page<Emp> page(String name, Short gender, LocalDate begin, LocalDate end);

    //
    //
    //
    //
    // 想用数组来装ids
    // void delete(Arrays[] ids);

    void delete(List<Integer> ids);
    //1.编辑员工信息时,数据回显
    Emp findById(Integer id);

    void insert(Emp emp);

    void update(Emp emp);


    @Select("select * from  tlias.emp where username=#{username} and password=#{password}")
    Emp getgetByUsernameAndPassword(Emp emp);


    //@Select("select count(*) from tlias.emp")
    //Long count();

    //@Select("select * from  tlias.emp limit #{param1},#{param2} ")
    //List<Emp> pageQuerey(Integer start, Integer pageSize);

    @Delete("delete from emp where dept_id=#{deptId}")
    public int deleteByDeptId(Integer deptId);



}
